<%= form_for section.blocks.new, url: spree.admin_page_section_blocks_path(section), html: { class: 'list-group-item sidebar-page-block px-0 py-1 border-0 rounded'}, data: { controller: 'block-form', block_form_target: :form } do |f| %>
  <%= f.hidden_field :type, data: { block_form_target: 'type' } %>

  <%= dropdown portal: false do %>
    <%= dropdown_toggle class: 'btn-sm btn-secondary d-flex-inline' do %>
      <%= icon("circle-plus") %>
      <%= Spree.t(:add_page_block) %>
    <% end %>
    <%= dropdown_menu do %>
    <% section.available_blocks_to_add.each do |block_class| %>
      <a href="#" class="dropdown-item btn-sm"
          data-action="click->block-form#addBlock"
        data-block-form-type-param="<%= block_class %>"
        >
        <% block_instance = block_class.new %>
        <%= icon block_instance.icon_name, height: 18, class: 'mr-2' if block_class.new.icon_name.present? %>
        <%= block_instance.display_name.presence || block_class.to_s.demodulize.titleize %>
      </a>
    <% end %>
    <% end %>
  <% end %>
<% end %>
